Modern programming languages, such as Java and C#, typically provide featuresthat handle exceptions. These features separate error-handling code fromregular source code and aim to assist in the practice of software comprehensionand maintenance. Having acknowledged the advantages of exception handlingfeatures, their misuse can still cause reliability degradation or evencatastrophic software failures. Prior studies on exception handling aim tounderstand the practices of exception handling in its different components,such as the origin of the exceptions and the handling code of the exceptions.Yet, the observed findings were scattered and diverse. In this paper, tocomplement prior research findings on exception handling, we study its featuresby enriching the knowledge of handling code with a flow analysis of exceptions.Our case study is conducted with over 10K exception handling blocks, and over77K related exception flows from 16 open-source Java and C# (.NET) librariesand applications. Our case study results show that each try block has up to 12possible potentially recoverable yet propagated exceptions. More importantly,22% of the distinct possible exceptions can be traced back to multiple methods(average of 1.39 and max of 34). Such results highlight the additionalchallenge of composing quality exception handling code. To make it worse, weconfirm that there is a lack of documentation of the possible exceptions andtheir sources. However, such critical information can be identified byexception flow analysis on well- documented API calls (e.g., JRE and .NETdocumentation). Finally, we observe different strategies in exception handlingcode between Java and C#. Our findings highlight the opportunities ofleveraging automated software analysis to assist in exception handlingpractices and signify the need of more further in-depth studies on exceptionhandling practice.
展开▼